﻿using Newtonsoft.Json;
using Quartz;

namespace quartz.net简单封装
{
    public class QuartaJob : IJob
    {
        public ActionJob _Action { get; set; }//必须以大写或下划线开头

        public Task Execute(IJobExecutionContext context)
        {
            return Task.Factory.StartNew(async () =>
            {
                await _Action.Execute();
            });
        }
    }
    public class ActionJob
    {
        private Action _Action;

        public ActionJob(Action action)
        {
            _Action = action;
        }

        public async Task Execute()
        {
            _Action.Invoke();
            await Task.CompletedTask;
        }
    }
}